<div class="am-cf am-padding">
    <div class="am-fl am-cf">
        <strong class="am-text-primary am-text-lg">首页</strong> /
        <small>宝石管理</small> /
        <small>新增宝石</small>
    </div>
</div>

<!-- <div class="am-padding">
    <a class="am-btn am-btn-default am-btn-xs am-text-secondary" href="{:U('gemAdd')}">新增宝石</a>
</div> -->

<div class="am-g">
    <div class="am-u-sm-12">
        <form enctype="multipart/form-data" id="gem-form" class="am-form" action="{:U('gemAdd')}" method="POST">
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石标题
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <input type="text" class="am-input-sm" name="title" value="">
                </div>
            </div>

            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石类别1
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <select name="type1">
                        <foreach name="type1" item="o">
                            <option value="{$o.id}">{$o.name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石类别2
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <select name="type2">
                        <foreach name="type2" item="o">
                            <option value="{$o.id}">{$o.name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石价格范围
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <select name="ptype">
                        <foreach name="ptype" item="o">
                            <option value="{$o.id}">{$o.name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石重量范围
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <select name="wtype">
                        <foreach name="wtype" item="o">
                            <option value="{$o.id}">{$o.name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石证书类型
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <select name="ctype">
                        <foreach name="ctype" item="o">
                            <option value="{$o.id}">{$o.name}</option>
                        </foreach>
                    </select>
                </div>
            </div>

            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石价格
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <input type="text" class="am-input-sm" name="price" value="">
                </div>
            </div>

            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石简介
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <input type="text" class="am-input-sm" name="summary" value="">
                </div>
            </div>

            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    标题图
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <input type="file" name="pic[]">
                    <input type="file" name="pic[]">
                    <input type="file" name="pic[]">
                    <input type="file" name="pic[]">
                    <input type="file" name="pic[]">
                </div>
            </div>

            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    宝石内容
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <!-- <input id="content" type="hidden"> -->
                    <textarea name="content" id="container" style="width: 500px; height: 300px;"></textarea>
                </div>
            </div>
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">
                    &nbsp;
                </div>
                <div class="am-u-sm-4 am-u-end">
                    <a id="sub" class="am-btn am-btn-default am-btn-xs am-text-secondary">提交</a>
                    <a class="am-btn am-btn-default am-btn-xs am-text-danger" href="{:U('gem')}">取消</a>
                </div>
            </div>
        </form>

    </div>
</div>

<script type="text/javascript" charset="utf-8">
    window.UEDITOR_HOME_URL = "__PUBLIC__/Ueditor/";
    var editor;
    $(function () {
        editor = UE.getEditor('container', {
            toolbars: [
                [
                    'undo', 'redo', '|',
                    'bold', 'italic', 'underline', 'fontborder', 'strikethrough',
                    'superscript', 'subscript', 'removeformat', 'autotypeset', 'blockquote',
                    'pasteplain', '|',
                    'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist',
                    'selectall', 'cleardoc', '|',
                    'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                    'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                    'directionalityltr', 'directionalityrtl', 'indent', '|',
                    'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
                    'touppercase', 'tolowercase', '|',
                    'link', 'unlink', 'anchor', '|',
                    'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
                    'simpleupload', '|',
                    'drafts',
                ]
            ],
            initialFrameHeight: 500,
            initialFrameWidth: 1100,
            serverUrl: "{:U(MODULE_NAME.'/Index/save_info')}"
        });

        $('#sub').click(function () {
            editor.sync()
            var f = $('#gem-form')[0]
            f.submit();
        })
    });
</script>